const express = require("express");
const cors = require("cors");
const { resolve } = require("path");
const { CORS } = require("../../config");

module.exports = (app) => {
    // 静态资源目录
    app.use("/uploads", express.static(resolve(__dirname, "../../uploads")));
    // 跨域设置
    app.use(
        cors({
            origin: CORS,
            credentials: true
        })
    );
    // 解析请求体
    app.use(express.json());
    app.use(express.urlencoded({ extended: true }));
};
